{layout name="layout" /}

<div class="Hui-article">
    <article class="cl pd-20">
        <form action="" method="post" class="form form-horizontal" id="form-category-add">
            <!-- 文章标题 -->
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">* </span>标题：</label>
                <div class="formControls col-xs-8 col-sm-4">
                    <input type="text" class="input-text" value="" placeholder="文章标题,不超过100个字符" id="title" name="title">
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">* </span>标题图：</label>
                <div class="formControls col-xs-8 col-sm-4">
                    <input type="text" class="input-text" value="" id="thumb" name="thumb" placeholder="标题图, 可以是网络图片, 大小不要超过40kb">
                </div>
                <div class="formControls col-xs-8 col-sm-2">
                    <a href="javascript:;" class="btn btn-primary radius" onClick="addthumb()">
                        <i class="Hui-iconfont">&#xe600;</i>添加标题图</a>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">
                    <span class="c-red">*</span>文章内容：</label>
                <div class="formControls col-xs-8 col-sm-6">
                    <script id="editor" type="text/plain" style="width:100%;height:400px;">此处输入文章正文...</script>
                </div>
                <div class="col-3"> </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2">排序</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="number" class="input-text" value="" name="sort" min="0" max="99">
                </div>
                <span class="c-red">* 两位以内整数; 数值越大,排序越靠前</span>
                <div class="col-3"></div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button class="btn btn-primary radius" type="submit">
                        <i class="Hui-iconfont">&#xe632;</i> 保存提交</button>
                    <button type="button" class="btn btn-default radius" onClick="window.history.back();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
                </div>
            </div>
        </form>
    </article>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/ueditor.all.min.js"></script>
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
    $(function () {
        //实例化编辑器   
        var ue = UE.getEditor('editor');

        //提交表单
        $("#form-category-add").submit(function () {
            var note = $("#description").val();

            if (!$("#title").val()) {
                layer.msg('标题不能为空!', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }

            if (getblen(note) > 300) {
                layer.msg('备注过长', {
                    icon: 5,
                    time: 1000
                });
                return false;
            }
        })
    });

    //添加缩略图
    function addthumb() {
        layer.open({
            type: 2,
            area: ['700px', '500px'],
            fix: false, //不固定
            maxmin: true,
            shade: 0.4,
            title: '添加缩略图',
            content: '{:url("file_manager/addThumb")}'
        });
    }
</script>
<!--请在上方写此页面业务相关的脚本-->